<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8"/>
	<title>demo1</title>
	<meta name="keywords" content=""/>
	<meta name="description" content=""/>
	<meta name="viewport" content="width=device-width"/>
	<link rel="shortcut icon" href="img/touchicon.png"/>
	<link rel="stylesheet" href=""/>
	<style type="text/css">
		#output{margin-top:10px;width:500px;height:200px;outline:1px solid #cdcdcd;}
	</style>
</head>
<body>
	<input type="button" value="评分：" id="btn">
	<input type="text" id="input">
	<div id="output">	
	</div>
	<script>
		var inPut,btn,outPut;
		inPut = document.getElementById('input');
		btn = document.getElementById('btn');
		outPut = document.getElementById('output');	

		btn.onclick = function foo () {
			var s = '';
			var v = Math.floor(inPut.value/10);  //inPut.value/10,隐式转换字符串为数值型
			switch (v) {
				case 10:
				case 9:
					s = v + ' 成绩：优秀';
					break;
				case 8:
				case 7:
				case 6:
					s = v + ' 成绩：良好';
					break;
				default:
					s = v + ' 成绩：不及格';
					break;
			}
			outPut.innerHTML = ' 成绩：你的分数是：' + s ;
		}
		
	</script>
</body>
</html>